/*
 * Copyright 2012 Gregor Schauer
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package at.schauer.gregor.vienna.datastore;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Collections;

/**
 * @author Gregor Schauer
 */
public class EmptyDataStore<T> implements DataStore<T> {
	private static final EmptyDataStore instance = new EmptyDataStore();

	@Nonnull
	@SuppressWarnings("unchecked")
	public static <T> EmptyDataStore<T> getInstance() {
		return instance;
	}

	@Nullable
	@Override
	public <E extends T> E load(@Nullable Class<E> type, @Nullable Object identifier) {
		return null;
	}

	@Nullable
	@Override
	public Object save(@Nullable T obj) {
		return null;
	}

	@Override
	public void delete(@Nullable T obj) {
	}

	@Nonnull
	@Override
	public <E extends T> Collection<E> list(@Nullable Class<E> type) {
		return Collections.emptyList();
	}
}
